import axios from "axios";

let config = {
  withCredentials: true,
};
const instance = axios.create(config);

instance.defaults.headers.common["Pragma"] = "no-cache";
instance.defaults.headers.common["Cache-Control"] = "no-cache";
instance.defaults.headers.common["Cache-Control"] = "no-store";
instance.interceptors.request.use(
  function (config) {
    const method = config["method"];
    if (!method || /get/i.test(method)) {
      const t = new Date().getTime();
      config.params = Object.assign({}, config.params, { _: t });
    }
    return config;
  },
  function (error) {
    return Promise.reject(error);
  }
);
export default instance;
